
from typing import Generic, Optional, TypeVar
from pydantic import BaseModel
from sqlmodel import Field

T = TypeVar('T')
class R(BaseModel,Generic[T]):
    "该类未使用"
    code:Optional[int] = Field(default=0,title="状态码")
    msg:Optional[str] = Field(default="success",title="状态信息")
    data:Optional[T] = None
    def __init__(self,status_code: int = 200,
                 code: Optional[int] = 0, 
                 msg: Optional[str] = "success", 
                 data: Optional[T] = None):
        super().__init__(code=code, msg=msg, data=data, status_code=status_code)
    @staticmethod
    def success(data:T=None,status_code:int=200,code=0,msg='success'):
        return R(status_code=status_code,data=data,code=code,msg=msg)
    @staticmethod
    def error():
        return 
